//Coded by Brian Dawn.
//Face loading currently only works with 3ds max format, probably.
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>

#include <GL/glut.h>

struct vec
{
	float x,y,z;
};
struct face
{
	int vX, vtX, vnX; //vertex/texture/normal
	int vY, vtY, vnY;
	int vZ, vtZ, vnZ;
	std::string g; //texture?
};
struct matGroup
{
	std::string matName;
	face* aFaces;
	int numFaces;
	int aFPos;
};
class objModel
{
private:
	int numVertices;
	int numTextureVertices;
	int numVertexNormals;
	int numFaces;
	//int numMaterials; just get size of mat vector

	vec* aVertices;
	vec* aTextureVertices;
	vec* aVertexNormals;

	std::vector<matGroup*> vMatgrp; //aMatgrp[0] is first material block, etc. etc.

	void parseFace(std::string in);
public:
	std::string id; //ok that it's public, because only managers will have access.

	objModel();
	~objModel();
	bool load(const char* path);
	//void display(float xPos=0, float yPos=0, float zPos=0, float xRot=0, float yRot=0, float zRot=0);
	void display(float xPos=0, float yPos=0, float zPos=0, float xRot=0, float yRot=0, float zRot=0, std::string matName="");
	int numMatGroups();
	std::string getMatName(int matGroup);
	
};